<? if($this->pageArray['pageNumber']>0):?>
			<form name="productIndexForm" id="productIndexForm" action="admins<?=CHOSING_DE?>product<?=CHOSING_DE?>del" method="post">
				<table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#CEE7FF" style="border-collapse:collapse">
					<tr>
						<td width="6%" class="bbgg">
							<strong>勾选</strong>
						</td>
						<td width="6%" class="bbgg">
							<strong>订单号</strong>
						</td>
                                                <td width="10%" class="bbgg">
							<strong>运单号</strong>
						</td>
						<td width="20%" class="bbgg">
							<strong>下订时间</strong>
							<br />
							<strong>付款时间</strong>
						</td>
						<td width="18%" class="bbgg">
							<strong>买家</strong>
						</td>
						<td width="8%" class="bbgg">
							<strong>订单金额</strong>
						</td>
						<td width="7%" class="bbgg">
							<strong>积分派送</strong>
						</td>
						<td width="8%" class="bbgg">
							<strong>状态</strong>
						</td>
						<td width="10%" class="bbgg">
							<strong>操作</strong>
						</td>
					</tr>		
					<?foreach($this->orderArray as $value):?>					
					<tr bgcolor="#FFFFFF">
						<td align="center">
							<input type="checkbox" value="<?=$value['orderid']?>" name="orderidprint[]" />
						</td>
						<td align="center" valign="middle">
							G<?=$value['orderid']?>
						</td>
                                                <td align="center" valign="middle">
							<?=$value['sendid']?>
						</td>
						<td align="center">
							<?=date('Y-m-d H:i:s',$value['add_time'])?>
							<br />
							<?if($value['pay_time']!=0):?>
								<?=date('Y-m-d H:i:s',$value['pay_time'])?>
							<?else:?>
								未付款  <?php if ($value['email_paypal'] != "''"):?>paypal email: <?php echo $value['email_paypal'];?><?php endif;?>
							<?endif;?>
						</td>
						<td align="center">
							<?php if (!empty($value['username'])):?>
								<?php echo $value['username'];?>
							<?php else:?>
								<?php echo '从' . $value['reg_from'] . '注册';?>
							<?php endif;?>
						</td>
						<td align="center">
							$<?=round($value['money']*$value['discount'],2)?>
						</td>
						<td align="center">
							<?php 
								$score = new CScore();								
								if ($value['flid'] >= 2 && $value['flid'] != 6 && $value['flid'] != 7 && $value['flid'] != 8) {
									if ($value['order_score_statu'] == 0 && $value['order_score_statu'] == 0) {
										echo '未派送 ,应送' . $score->dollar2score(round($value['money']*$value['discount'],2)/ORDER_DOLLAR);
									} elseif ($value['order_score_statu'] == 1 && $value['order_score_statu'] == 1) {
										echo '已派送';
									}
								} else {
									echo '未付款或取消';
								}
							?>
						</td>
						<td align="center">
							<?=$value['flname']?>
						</td>
						<td align="center">
							<a href="administrator-order-more?orderid=<?=$value['orderid']?>">详细</a> 
							<?if($value['flid']=='1'):?>
							<a onclick="return shouldCancel();" href="administrator-order-docancel?orderid=<?=$value['orderid']?>">取消</a>
							<?endif;?>
						</td>
					</tr>
					<? endforeach;?>
					<tr bgcolor="#FFFFFF">
						<td align="center" colspan="2">
							<input type="checkbox" id="checkall" />
							<input type="button" value="打印" onclick="orderprint();" />
						</td>
						<td align="center" colspan="6">
						</td>
					</tr>												
				</table>
				<br />
				<div class="factory_page">共 <?=$this->pageArray['pageNumber']?> 页/当前<?php echo $this->pageArray['page'];?>　<?=$this->pageString?></div>
			</form>
<?else:?>
	<table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#CEE7FF" style="border-collapse:collapse">
		<tr>
			<td><?=$this->getMsg('该状态下暂无订单!');?></td>
		</tr>											
	</table>
<?endif;?>

<script>
$(function($){
	$("#checkall").click(function(){
		if(this.checked) {
			$('input[name="orderidprint[]"]').each(function(){
				$(this).attr("checked",true);
			});
		}
		if(!this.checked) {
			$('input[name="orderidprint[]"]').each(function(){
				$(this).attr("checked",false);
			});
		}
	});
});
function orderprint()
{
	var ischeck = false;
	//var id_str = "";
	$('input[name="orderidprint[]"]').each(function(){
		if(this.checked == true) {
			ischeck = true;
		}
	});
	if(ischeck == true) {
		$("#productIndexForm").attr("action","administrator<?=CHOSING_DE?>order<?=CHOSING_DE?>printorders");
		$("#productIndexForm").attr("target","_blank");
		$("#productIndexForm").submit();
	} else {
		alert("请勾选要打印的订单");
	}
}

function shouldCancel(){
	if(confirm("确认要取消该订单吗?")){
		return true;
	}else{
		return false;
	}
}
</script>